//
//  WSQSelectionItem.m
//  RACTest
//
//  Created by 翁胜琼 on 2018/10/12.
//  Copyright © 2018 翁胜琼. All rights reserved.
//

#import "WSQSelectionItem.h"

static NSString* const kRootClassTitle = @"title";
static NSString* const kRootClassValue = @"value";

@implementation WSQSelectionItem

+ (instancetype)initWithTitle:(NSString *)title value:(id)value
{
    
    WSQSelectionItem *item = [[WSQSelectionItem alloc] init];
    item.title = title;
    item.value = value;
    
    return item;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [self init];
    if (self) {
        self.title = [coder decodeObjectForKey:kRootClassTitle];
        self.value = [coder decodeObjectForKey:kRootClassValue];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
    if(self.title != nil){
        [coder encodeObject:self.title forKey:kRootClassTitle];
    }
    if(self.value != nil){
        [coder encodeObject:self.value forKey:kRootClassValue];
    }
    
}

@end
